<?php

namespace Lib;

class Error {
	private $_aError = array ();
	private $_iCode = 0;
	private $_sMessage = null;

	public function set($iCode, $sMessage = null) {
		$this->_iCode = $iCode;
		$this->_sMessage = $sMessage;
		$this->_aError [] = array (
				'code' => $iCode,
				'message' => $sMessage 
		);
	}

	public function get() {
		if ($this->_iCode) {
			return array (
					'error' => $this->_iCode,
					'message' => $this->_sMessage 
			);
		} else {
			return array (
					'error' => 0 
			);
		}
	}
}
?>